import http from '@/utils/request'
//获取购物车列表
function getCartListReq() {
  return http({
    method: 'get',
    url: '/api/v1/shop_carts',
  })
}
//加入购物车
// amount    根据传递的数量正负，会自动的计算最新的数量
function postAddProductToCartReq(product, amount, price) {
  return http({
    method: 'post',
    url: '/api/v1/shop_carts',
    data: { product, amount, price },
  })
}
//删除购物车数据
function delProductFromCartReq(id) {
  return http({
    method: 'delete',
    url: '/api/v1/shop_carts/' + id,
  })
}

export { getCartListReq, postAddProductToCartReq, delProductFromCartReq }
